<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%> 
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>   
     
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" href="${host_url}/css/app/common.css">
<link rel="stylesheet"  href="${host_url}/css/app/profit.css">
<link rel="stylesheet"  href="${host_url}/css/app/dropload.css">
<script type="text/javascript" src="${host_url}/js/app/jquery.min.js"></script>
<script src="${host_url}/js/app/dropload.min.js"></script>
<script type="text/javascript">
  document.getElementsByTagName('html')[0].style.fontSize = document.documentElement.clientWidth/50 + 'px';
 
 function GetToken(id){
	 var unSettlementOne_url = $("#unSettlementOne_url").val();
     window.webkit.messageHandlers.ios_open_page.postMessage('WKViewController:::url->'+unSettlementOne_url+'?unSettlement_id='+id+':::webTitle->交易明细:::isRefresh->YES');
  } 
 var m_os="${os}";
 var unSettlementItem;
 if(m_os=="wechat" || m_os=='web'){
	 unSettlementItem="unSettlementItem.do"
 }else{
	 unSettlementItem="unSettlementItem";
 }
 
 $(function(){
		/* 页数 */
		var page_index_all = 2; /* 全部 */
		
	    /* dropload 加载分页 */
	    loadPagination("listAll",page_index_all,"logAll");
	});	

	function loadPagination(div_id, page_index, ul_id){
		$('#'+div_id).dropload({
	        scrollArea : window,
	        loadDownFn : function(me){
	            $.ajax({
	                type: 'get',
	                url: unSettlementItem+'?page_index='+page_index,
	                dataType: 'text',
	                beforeSend: function(request) {
	    				request.setRequestHeader("AUTHORIZATION","${token}");
	    				request.setRequestHeader("SECRET","${memberId}");
	    				request.setRequestHeader("OS","${os}");
	    			 }, 
	                contentType:"application/x-www-form-urlencoded; charset=UTF-8",
	                success: function(msg){
	                    if($.trim(msg)){
	                		page_index++;
	                    	$("#"+ul_id).append(msg);
	                    	me.resetload();
	                    /* 如果没有数据 */
	                    } else{
	                         /* 锁定 */
	                        me.lock();
	                         /* 无数据 */
	                        me.noData();
	                        if($("#"+ul_id+" > li")){
		                    	   $("#"+div_id+" .dropload-load").html("");
		                    }else{
		                    	 $("#"+div_id+" .dropload-load").html("");
		                    }
	                    } 
	                },
		                error: function(xhr, type){
	                     /* 即使加载出错，也得重置 */
	                    me.resetload();
	                } 
	            });
	        }
	    });
	}
</script>
<style>

</style>
<title>待结算收益</title>
</head>
<body style="font-size:14px;">
<input type="hidden"  id="unSettlementOne_url" value="${unSettlementOne_url }">
<c:if test="${logearnList.size()>0}">
	<div class="content" id="listAll">
	    <ul id="logAll">
	    <c:forEach items="${logearnList}" var="c">
	     <c:if test="${c.state == 1}">	
	        <c:if test="${'ios'==os}">
		   		 <li class="clearfix" onclick="GetToken(${c.unSettlement_id})">
            </c:if>
    	    <c:if test="${'android'==os}">
            	<li class="clearfix" onclick="android.startUrl('交易明细','${unSettlementOne_url}','unSettlement_id->${c.unSettlement_id}')">
            </c:if>
            <c:if test="${'wechat'==os ||'web'==os}">
            	<li class="clearfix" onclick="unaccountDetail('${c.unSettlement_id}')">
            </c:if>
	            <p class="leftArea">
	                <span class="black" style="color:#000;font-size:14px;">${c.award_name}</span><br>
	                <span class="gray" style="color:#999;font-size:14px;">${c.create_time}</span>   
	            </p>
	            <p class="rightArea" style="font-size:14px;">${c.free_cash}</p>
	        </li>
	      </c:if>
	      <c:if test="${c.state == 3}">
	     	<c:if test="${'ios'==os}">
		   		 <li class="clearfix color" onclick="GetToken(${c.unSettlement_id})">
            </c:if>
    	    <c:if test="${'android'==os}">
            	<li class="clearfix color" onclick="android.startUrl('交易明细','${unSettlementOne_url}','unSettlement_id->${c.unSettlement_id}')">
            </c:if>	  
    	   <c:if test="${'wechat'==os ||'web'==os}">
            	<li class="clearfix color" onclick="unaccountDetail('${c.unSettlement_id}')">
            </c:if>	  
	            <p class="leftArea">
	                <span>${c.award_name}&nbsp;(已取消)</span><br>
	                <fmt:parseDate value=" ${c.create_time}" var="date" pattern="yyyy-MM-dd HH:mm:ss"/>  
			  		<span><fmt:formatDate value="${date}" pattern="yyyy-MM-dd HH:mm" /></span> 
	            </p>
	            <p class="rightArea">${c.free_cash}</p>
	        </li>
	      </c:if>	       
	    </c:forEach>     
	    </ul>
	</div>  
</c:if>
<c:if test="${logearnList.size()==0}">
	<div class="zanwu">
	  <span><img src="${host_url}/img/app/zanwu.png"></span>
	  <p>暂无记录</p>
	</div>
</c:if> 
</body>
</html>